<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>

<script>
    
    // 求和计算
    function sum(num1, num2) {
        this.sum1 = num1 + num2;
    }
    sum(10, 20);
    console.log(window.sum1);
    

    var obj = {
        name: 'jack'
    }

    sum.apply(obj, [30, 80]);
    console.log(obj);


    var arr = [];
    // apply(对象， [参数1， 参数2...])
    // push(参数1， 参数2...)
    arr.push.apply(arr, [10, 100, 30, 34]);
    console.log(arr);

    // arr.push(element1, ..., elementN)
    // arr.push(10, 100, 20, 34)
    
    
    

</script>
    
</body>
</html>